#!/usr/bin/env python

import BaseHTTPServer
import CGIHTTPServer
import cgitb
import sys

sys.stdout = open('log.txt' , 'a')
sys.stderr = open('log.txt' , 'a')

server = BaseHTTPServer.HTTPServer
handler = CGIHTTPServer.CGIHTTPRequestHandler

server_address = ("127.0.0.1", 8000)
handler.cgi_directories = ["cgi.py"]

httpd = server(server_address, handler)
httpd.serve_forever()
